Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyPair.fromSecretSeet on char array #447

Merged
merged 1 commit into from
Jul 25, 2022
Merged

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented Jul 25, 2022

close #445

fromSecretSeed(char[] seed) decodes the seed into a byte array which is eventually passed into EdDSAPrivateKeySpec (defined in a library). EdDSAPrivateKeySpec stores a reference to the byte array in the class definition. So when we clear out the byte array using Arrays.fill(decoded, (byte) 0); it will actually affect EdDSAPrivateKeySpec. Consequently, getSecretSeed() will end up returning the private key corresponding to all zeros instead of the seed.

@tamirms tamirms requested review from sreuland and bartekn July 25, 2022 09:10
@tamirms tamirms merged commit 9c778c8 into master Jul 25, 2022
@tamirms tamirms deleted the fix-from-secret-seed branch July 25, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Private key in KeyPair is invalid when created with fromSecretSeed(char[] seed)
2 participants